class Cart < ActiveRecord::Base
  validates_presence_of :campsite, :arrival_date
  
  def validate
    errors.add(:adults, "adults can't be less than 1 or more than 8") if adults.nil? || adults < 1 || adults > 8
    errors.add(:nights, "should be equal to or less than 2 and more than 0") if nights.nil? ||  nights > 2 ||  nights < 1
    errors.add(:total, "should be greater than 0") if total.nil? || total < 0.01
  end
  
end
